{% extends 'base.html' %}
{% block content %}
  <div class="card shadow-sm p-4 mb-4">
    <h2 class="fw-bold mb-2">{{ theme.title }} - {{ round.title }}</h2>
    <p class="text-muted mb-3">{{ round.description }}</p>
    <form method="post">
      <div class="mb-3">
        {% for opt in round.options %}
          <div class="form-check mb-2">
            <input class="form-check-input" type="checkbox" name="option" value="{{ opt.id }}" id="opt{{ opt.id }}" {% if opt.id in voted %}checked disabled{% endif %} {% if voted %}disabled{% endif %}>
            <label class="form-check-label" for="opt{{ opt.id }}">{{ opt.label }}</label>
          </div>
        {% endfor %}
      </div>
      {% if voted %}
        <div class="alert alert-success rounded-pill px-4">你已投票，选择：
          {% for opt in round.options if opt.id in voted %}
            <span class="badge bg-primary rounded-pill">{{ opt.label }}</span>
          {% endfor %}
        </div>
      {% else %}
        <button type="submit" class="btn btn-primary rounded-pill px-4">提交投票</button>
      {% endif %}
      <a href="{{ url_for('theme_detail', theme_id=theme.id) }}" class="btn btn-link">返回主题</a>
    </form>
  </div>
{% endblock %}
